package com.mtzqc

import android.app.Application
import android.content.Context
import androidx.multidex.MultiDex

abstract class SupportApp : Application() {

    override fun onCreate() {
        super.onCreate()
        initApp()
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        installMultiDex()
    }

    open fun installMultiDex() {
        MultiDex.install(this)
    }

    open fun initApp() {
        initApp(this)
    }

    companion object {
        private var app: Application? = null
        fun initApp(application: Application) {
            app = application
        }

        fun app(): Application {
            return app!!
        }
    }
}